package com.ygqh.baby.model;

import com.ygqh.baby.ao.CardType;
import com.ygqh.baby.ao.Message;
import com.ygqh.baby.utils.DateConvertUtils;

import java.util.Date;
import java.util.List;

/**
 * @author: sunshuo
 * @date: 2018/12/27 17:03
 */
public class CardCouponAction {

	private String sourceCode;

	private Boolean onlyNew = Boolean.FALSE;

	private List<String> skuCodeListForGift;

	private String defaultSkuCode;

	private CardType cardType = CardType.DrawPrize;

	private Date startDate;

	private Date endDate;

	private Date createTime;

	private String createBy;

	private Date updateTime;

	private String updateBy;

	public String getSourceCode() {
		return sourceCode;
	}

	public void setSourceCode(String sourceCode) {
		this.sourceCode = sourceCode;
	}

	public Boolean getOnlyNew() {
		return onlyNew;
	}

	public void setOnlyNew(Boolean onlyNew) {
		this.onlyNew = onlyNew;
	}

	public List<String> getSkuCodeListForGift() {
		return skuCodeListForGift;
	}

	public void setSkuCodeListForGift(List<String> skuCodeListForGift) {
		this.skuCodeListForGift = skuCodeListForGift;
	}

	public String getDefaultSkuCode() {
		return defaultSkuCode;
	}

	public void setDefaultSkuCode(String defaultSkuCode) {
		this.defaultSkuCode = defaultSkuCode;
	}

	public CardType getCardType() {
		return cardType;
	}

	public void setCardType(CardType cardType) {
		this.cardType = cardType;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public Message validateActionDate() {
		Date today = DateConvertUtils.getDateStart(new Date());
		if (startDate != null && today.before(startDate)) {
			return Message.error("活动未开始", null);
		}
		if (endDate != null && today.after(endDate)) {
			return Message.error("活动已结束", null);
		}
		return Message.success(null);
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getCreateBy() {
		return createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getUpdateBy() {
		return updateBy;
	}

	public void setUpdateBy(String updateBy) {
		this.updateBy = updateBy;
	}
}
